<div class="page_function">
  <div class="info">
    <h3>扩展模型管理</h3>
    <small>将栏目与扩展模型进行绑定来实现附加字段功能</small> </div>
  <div class="exercise"> 
   <a href="javascript:menuload('__URL__')">模型列表</a>
   <?php if(model('user_group')->model_power('expand_model','add')){ ?>
   <a href="javascript:;" onclick="add()">添加模型</a>
   <?php } ?>
   <?php if(model('user_group')->model_power('expand_model','in')){ ?>
   <a href="javascript:;" onclick="model_in('__URL__/in')">导入模型</a>
   <?php } ?>
   </div>
</div>
<div class="page_main">
  <div class="page_table table_list">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <th width="10%"><center>MID</center></th>
        <th width="30%">模型名称</th>
        <th width="30%"><center>模型数据表</center></th>
        <th width="30%"><center>模型操作</center></th>
      </tr>
      <!--foreach:{$list $vo}-->
      <tr>
        <td><center>{$vo.mid}</center></td>
        <td>{$vo.name}</td>
        <td><center>{$vo.table}</center></td>
        <td><center>
        <?php if(model('user_group')->model_power('expand_model','edit')){ ?>
        <a href="__URL__/field_list/mid-{$vo.mid}">字段管理</a>
         &nbsp;&nbsp;<a  href="javascript:void(0);" onclick="edit('{$vo.mid}')">修改</a>
         <?php } ?>
         <?php if(model('user_group')->model_power('expand_model','out')){ ?>
         &nbsp;&nbsp;<a  href="javascript:void(0);" onclick="out('{$vo.mid}')">导出</a>
         <?php } ?>
         <?php if(model('user_group')->model_power('expand_model','del')){ ?>
         &nbsp;&nbsp;<a href="javascript:void(0);" onclick="del('{$vo.mid}',this)">删除</a>
         <?php } ?>
         </center></td>
      </tr>
      <!--{/foreach}-->
    </table>
  </div>
</div>

<div class="page_tool">
  <div class="page"></div>
</div>
<script>
//添加
function add() {
	urldialog({
	title:'模型添加',
	url:'__URL__/add'
	});
};
//修改
function edit(url) {
	urldialog({
	title:'模型编辑',
	url:'__URL__/edit/mid-'+url
	});
};
function model_in(url) {
	urldialog({
	title:'模型导入',
	url:url
	});
};
function out(mid) {
	ajaxpost({
		name:'导出的文件将在网站目录下的"data/ext_module"中，请自行下载！',
		url:"__URL__/out",
		data:{mid:mid},
		tip:1
	});
};
//删除
function del(mid,obj) {
	var obj;
	ajaxpost({
		name:'删除模型后会同时删除模型表和内容! ',
		url:"__URL__/del",
		data:{mid: mid},
		tip:1,
		success:function(){
			$(obj).parent().parent().parent().remove();
		}
	});
}
</script>